Optimal. Leaf size=129 \[ -\frac {\left (b^2-2 a c-2 c^2\right ) \tanh ^{-1}\left (\frac {b+2 c \cos (x)}{\sqrt {b^2-4 a c}}\right )}{(a-b+c) (a+b+c) \sqrt {b^2-4 a c}}+\frac {\log (1-\cos (x))}{2 (a+b+c)}-\frac {\log (1+\cos (x))}{2 (a-b+c)}+\frac {b \log \left (a+b \cos (x)+c \cos ^2(x)\right )}{2 (a-b+c) (a+b+c)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 129, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 8, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.471, Rules used = {3340, 995, 648,
632, 212, 642, 647, 31} \begin {gather*} -\frac {\left (-2 a c+b^2-2 c^2\right ) \tanh ^{-1}\left (\frac {b+2 c \cos (x)}{\sqrt {b^2-4 a c}}\right )}{(a-b+c) (a+b+c) \sqrt {b^2-4 a c}}+\frac {b \log \left (a+b \cos (x)+c \cos ^2(x)\right )}{2 (a-b+c) (a+b+c)}+\frac {\log (1-\cos (x))}{2 (a+b+c)}-\frac {\log (\cos (x)+1)}{2 (a-b+c)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 212
Rule 632
Rule 642
Rule 647
Rule 648
Rule 995
Rule 3340
Rubi steps
\begin {align*} \int \frac {\csc (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx &=-\text {Subst}\left (\int \frac {1}{\left (1-x^2\right ) \left (a+b x+c x^2\right )} \, dx,x,\cos (x)\right )\\ &=\frac {\text {Subst}\left (\int \frac {-a-c+b x}{1-x^2} \, dx,x,\cos (x)\right )}{(a-b+c) (a+b+c)}-\frac {\text {Subst}\left (\int \frac {-b^2+a c+c^2-b c x}{a+b x+c x^2} \, dx,x,\cos (x)\right )}{(a-b+c) (a+b+c)}\\ &=\frac {\text {Subst}\left (\int \frac {1}{-1-x} \, dx,x,\cos (x)\right )}{2 (a-b+c)}-\frac {\text {Subst}\left (\int \frac {1}{1-x} \, dx,x,\cos (x)\right )}{2 (a+b+c)}+\frac {b \text {Subst}\left (\int \frac {b+2 c x}{a+b x+c x^2} \, dx,x,\cos (x)\right )}{2 (a-b+c) (a+b+c)}+\frac {\left (b^2-2 c (a+c)\right ) \text {Subst}\left (\int \frac {1}{a+b x+c x^2} \, dx,x,\cos (x)\right )}{2 (a-b+c) (a+b+c)}\\ &=\frac {\log (1-\cos (x))}{2 (a+b+c)}-\frac {\log (1+\cos (x))}{2 (a-b+c)}+\frac {b \log \left (a+b \cos (x)+c \cos ^2(x)\right )}{2 (a-b+c) (a+b+c)}-\frac {\left (b^2-2 c (a+c)\right ) \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c \cos (x)\right )}{(a-b+c) (a+b+c)}\\ &=-\frac {\left (b^2-2 c (a+c)\right ) \tanh ^{-1}\left (\frac {b+2 c \cos (x)}{\sqrt {b^2-4 a c}}\right )}{(a-b+c) (a+b+c) \sqrt {b^2-4 a c}}+\frac {\log (1-\cos (x))}{2 (a+b+c)}-\frac {\log (1+\cos (x))}{2 (a-b+c)}+\frac {b \log \left (a+b \cos (x)+c \cos ^2(x)\right )}{2 (a-b+c) (a+b+c)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.21, size = 126, normalized size = 0.98 \begin {gather*} -\frac {\left (-2 b^2+4 c (a+c)\right ) \text {ArcTan}\left (\frac {b+2 c \cos (x)}{\sqrt {-b^2+4 a c}}\right )+\sqrt {-b^2+4 a c} \left (-((a-b+c) \log (1-\cos (x)))+(a+b+c) \log (1+\cos (x))-b \log \left (a+b \cos (x)+c \cos ^2(x)\right )\right )}{2 (a-b+c) (a+b+c) \sqrt {-b^2+4 a c}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.46, size = 121, normalized size = 0.94
method | result | size |
default | \(\frac {\ln \left (-1+\cos \left (x \right )\right )}{2 a +2 b +2 c}-\frac {\ln \left (\cos \left (x \right )+1\right )}{2 a -2 b +2 c}+\frac {\frac {b \ln \left (a +b \cos \left (x \right )+c \left (\cos ^{2}\left (x \right )\right )\right )}{2}+\frac {2 \left (-a c +\frac {1}{2} b^{2}-c^{2}\right ) \arctan \left (\frac {b +2 c \cos \left (x \right )}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}}{\left (a -b +c \right ) \left (a +b +c \right )}\) | \(121\) |
risch | \(-\frac {i x}{a +b +c}+\frac {i x}{a -b +c}-\frac {2 i x a b c}{a^{3} c -\frac {1}{4} a^{2} b^{2}+2 a^{2} c^{2}-\frac {3}{2} a \,b^{2} c +a \,c^{3}+\frac {1}{4} b^{4}-\frac {1}{4} b^{2} c^{2}}+\frac {i x \,b^{3}}{2 a^{3} c -\frac {1}{2} a^{2} b^{2}+4 a^{2} c^{2}-3 a \,b^{2} c +2 a \,c^{3}+\frac {1}{2} b^{4}-\frac {1}{2} b^{2} c^{2}}+\frac {\ln \left ({\mathrm e}^{i x}-1\right )}{a +b +c}-\frac {\ln \left ({\mathrm e}^{i x}+1\right )}{a -b +c}+\frac {2 \ln \left ({\mathrm e}^{2 i x}+\frac {\left (2 c a b -b^{3}+2 c^{2} b -i \sqrt {16 a^{3} c^{3}-20 b^{2} a^{2} c^{2}+32 a^{2} c^{4}+8 a \,b^{4} c -24 a \,b^{2} c^{3}+16 a \,c^{5}-b^{6}+4 b^{4} c^{2}-4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}+1\right ) a b c}{4 a^{3} c -a^{2} b^{2}+8 a^{2} c^{2}-6 a \,b^{2} c +4 a \,c^{3}+b^{4}-b^{2} c^{2}}-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {\left (2 c a b -b^{3}+2 c^{2} b -i \sqrt {16 a^{3} c^{3}-20 b^{2} a^{2} c^{2}+32 a^{2} c^{4}+8 a \,b^{4} c -24 a \,b^{2} c^{3}+16 a \,c^{5}-b^{6}+4 b^{4} c^{2}-4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}+1\right ) b^{3}}{2 \left (4 a^{3} c -a^{2} b^{2}+8 a^{2} c^{2}-6 a \,b^{2} c +4 a \,c^{3}+b^{4}-b^{2} c^{2}\right )}+\frac {i \ln \left ({\mathrm e}^{2 i x}+\frac {\left (2 c a b -b^{3}+2 c^{2} b -i \sqrt {16 a^{3} c^{3}-20 b^{2} a^{2} c^{2}+32 a^{2} c^{4}+8 a \,b^{4} c -24 a \,b^{2} c^{3}+16 a \,c^{5}-b^{6}+4 b^{4} c^{2}-4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}+1\right ) \sqrt {16 a^{3} c^{3}-20 b^{2} a^{2} c^{2}+32 a^{2} c^{4}+8 a \,b^{4} c -24 a \,b^{2} c^{3}+16 a \,c^{5}-b^{6}+4 b^{4} c^{2}-4 b^{2} c^{4}}}{8 a^{3} c -2 a^{2} b^{2}+16 a^{2} c^{2}-12 a \,b^{2} c +8 a \,c^{3}+2 b^{4}-2 b^{2} c^{2}}+\frac {2 \ln \left ({\mathrm e}^{2 i x}+\frac {\left (2 c a b -b^{3}+2 c^{2} b +i \sqrt {16 a^{3} c^{3}-20 b^{2} a^{2} c^{2}+32 a^{2} c^{4}+8 a \,b^{4} c -24 a \,b^{2} c^{3}+16 a \,c^{5}-b^{6}+4 b^{4} c^{2}-4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}+1\right ) a b c}{4 a^{3} c -a^{2} b^{2}+8 a^{2} c^{2}-6 a \,b^{2} c +4 a \,c^{3}+b^{4}-b^{2} c^{2}}-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {\left (2 c a b -b^{3}+2 c^{2} b +i \sqrt {16 a^{3} c^{3}-20 b^{2} a^{2} c^{2}+32 a^{2} c^{4}+8 a \,b^{4} c -24 a \,b^{2} c^{3}+16 a \,c^{5}-b^{6}+4 b^{4} c^{2}-4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}+1\right ) b^{3}}{2 \left (4 a^{3} c -a^{2} b^{2}+8 a^{2} c^{2}-6 a \,b^{2} c +4 a \,c^{3}+b^{4}-b^{2} c^{2}\right )}-\frac {i \ln \left ({\mathrm e}^{2 i x}+\frac {\left (2 c a b -b^{3}+2 c^{2} b +i \sqrt {16 a^{3} c^{3}-20 b^{2} a^{2} c^{2}+32 a^{2} c^{4}+8 a \,b^{4} c -24 a \,b^{2} c^{3}+16 a \,c^{5}-b^{6}+4 b^{4} c^{2}-4 b^{2} c^{4}}\right ) {\mathrm e}^{i x}}{c \left (2 a c -b^{2}+2 c^{2}\right )}+1\right ) \sqrt {16 a^{3} c^{3}-20 b^{2} a^{2} c^{2}+32 a^{2} c^{4}+8 a \,b^{4} c -24 a \,b^{2} c^{3}+16 a \,c^{5}-b^{6}+4 b^{4} c^{2}-4 b^{2} c^{4}}}{2 \left (4 a^{3} c -a^{2} b^{2}+8 a^{2} c^{2}-6 a \,b^{2} c +4 a \,c^{3}+b^{4}-b^{2} c^{2}\right )}\) | \(1397\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.82, size = 470, normalized size = 3.64 \begin {gather*} \left [-\frac {{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \sqrt {b^{2} - 4 \, a c} \log \left (-\frac {2 \, c^{2} \cos \left (x\right )^{2} + 2 \, b c \cos \left (x\right ) + b^{2} - 2 \, a c + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c \cos \left (x\right ) + b\right )}}{c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a}\right ) - {\left (b^{3} - 4 \, a b c\right )} \log \left (c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a\right ) + {\left (a b^{2} + b^{3} - 4 \, a c^{2} - {\left (4 \, a^{2} + 4 \, a b - b^{2}\right )} c\right )} \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) - {\left (a b^{2} - b^{3} - 4 \, a c^{2} - {\left (4 \, a^{2} - 4 \, a b - b^{2}\right )} c\right )} \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right )}{2 \, {\left (a^{2} b^{2} - b^{4} - 4 \, a c^{3} - {\left (8 \, a^{2} - b^{2}\right )} c^{2} - 2 \, {\left (2 \, a^{3} - 3 \, a b^{2}\right )} c\right )}}, -\frac {2 \, {\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c \cos \left (x\right ) + b\right )}}{b^{2} - 4 \, a c}\right ) - {\left (b^{3} - 4 \, a b c\right )} \log \left (c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a\right ) + {\left (a b^{2} + b^{3} - 4 \, a c^{2} - {\left (4 \, a^{2} + 4 \, a b - b^{2}\right )} c\right )} \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) - {\left (a b^{2} - b^{3} - 4 \, a c^{2} - {\left (4 \, a^{2} - 4 \, a b - b^{2}\right )} c\right )} \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right )}{2 \, {\left (a^{2} b^{2} - b^{4} - 4 \, a c^{3} - {\left (8 \, a^{2} - b^{2}\right )} c^{2} - 2 \, {\left (2 \, a^{3} - 3 \, a b^{2}\right )} c\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\csc {\left (x \right )}}{a + b \cos {\left (x \right )} + c \cos ^{2}{\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.50, size = 130, normalized size = 1.01 \begin {gather*} \frac {b \log \left (c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a\right )}{2 \, {\left (a^{2} - b^{2} + 2 \, a c + c^{2}\right )}} + \frac {{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \arctan \left (\frac {2 \, c \cos \left (x\right ) + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{{\left (a^{2} - b^{2} + 2 \, a c + c^{2}\right )} \sqrt {-b^{2} + 4 \, a c}} - \frac {\log \left (\cos \left (x\right ) + 1\right )}{2 \, {\left (a - b + c\right )}} + \frac {\log \left (-\cos \left (x\right ) + 1\right )}{2 \, {\left (a + b + c\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.97, size = 1003, normalized size = 7.78 \begin {gather*} \frac {\ln \left (\cos \left (x\right )-1\right )}{2\,\left (a+b+c\right )}-\frac {\ln \left (\cos \left (x\right )+1\right )}{2\,\left (a-b+c\right )}-\frac {\ln \left (b\,c^2+4\,c^3\,\cos \left (x\right )+\frac {\left (a\,\left (4\,b\,c-2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3+b^2\,\sqrt {b^2-4\,a\,c}-2\,c^2\,\sqrt {b^2-4\,a\,c}\right )\,\left (8\,a\,c^3+\cos \left (x\right )\,\left (-3\,b^3\,c+12\,b\,c^3+12\,a\,b\,c^2\right )+4\,c^4+4\,a^2\,c^2+3\,b^2\,c^2-\frac {\left (a\,\left (4\,b\,c-2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3+b^2\,\sqrt {b^2-4\,a\,c}-2\,c^2\,\sqrt {b^2-4\,a\,c}\right )\,\left (4\,b\,c^4+4\,b^3\,c^2+\cos \left (x\right )\,\left (-8\,a^3\,c^2+2\,a^2\,b^2\,c-8\,a^2\,c^3-20\,a\,b^2\,c^2+8\,a\,c^4+6\,b^4\,c-6\,b^2\,c^3+8\,c^5\right )-28\,a^2\,b\,c^2-24\,a\,b\,c^3+8\,a\,b^3\,c\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}-a\,b^2\,c\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}\right )\,\left (a\,\left (4\,b\,c-2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3+b^2\,\sqrt {b^2-4\,a\,c}-2\,c^2\,\sqrt {b^2-4\,a\,c}\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}-\frac {\ln \left (b\,c^2+4\,c^3\,\cos \left (x\right )+\frac {\left (a\,\left (4\,b\,c+2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3-b^2\,\sqrt {b^2-4\,a\,c}+2\,c^2\,\sqrt {b^2-4\,a\,c}\right )\,\left (8\,a\,c^3+\cos \left (x\right )\,\left (-3\,b^3\,c+12\,b\,c^3+12\,a\,b\,c^2\right )+4\,c^4+4\,a^2\,c^2+3\,b^2\,c^2-\frac {\left (a\,\left (4\,b\,c+2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3-b^2\,\sqrt {b^2-4\,a\,c}+2\,c^2\,\sqrt {b^2-4\,a\,c}\right )\,\left (4\,b\,c^4+4\,b^3\,c^2+\cos \left (x\right )\,\left (-8\,a^3\,c^2+2\,a^2\,b^2\,c-8\,a^2\,c^3-20\,a\,b^2\,c^2+8\,a\,c^4+6\,b^4\,c-6\,b^2\,c^3+8\,c^5\right )-28\,a^2\,b\,c^2-24\,a\,b\,c^3+8\,a\,b^3\,c\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}-a\,b^2\,c\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}\right )\,\left (a\,\left (4\,b\,c+2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3-b^2\,\sqrt {b^2-4\,a\,c}+2\,c^2\,\sqrt {b^2-4\,a\,c}\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________